package
{
	import flash.display.DisplayObjectContainer;

	public class Enabled
	{
		private var docChild:DisplayObjectContainer;

		public function target($child:DisplayObjectContainer = null):Enabled
		{
			this.docChild = $child;
			return this;
		}

		public function enabled($isChildren:Boolean = false, $isEnabled:Boolean = false):Enabled
		{
			if ("mouseChildren" in this.docChild)
				this.docChild.mouseChildren = true;
			if ("mouseEnabled" in this.docChild)
				this.docChild.mouseEnabled = true;

			var child:*;
			var leng:int = this.docChild.numChildren;
			var i:int = 0;
			while (i < leng)
			{
				child = this.docChild.getChildAt(i);
				if ("mouseChildren" in child)
					child.mouseChildren = $isChildren;
				if ("mouseEnabled" in child)
					child.mouseEnabled = $isEnabled;
				i++;
			}
			return this;
		}
	}
}